package com.ruoyi.manager.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.manager.domain.SoldierEmploymentInfo;
import com.ruoyi.manager.service.ISoldierEmploymentInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 退役军人_就业创业Controller
 * 
 * @author Allen
 * @date 2021-08-30
 */
@RestController
@RequestMapping("/manager/retirefm_3")
public class SoldierEmploymentInfoController extends BaseController
{
    @Autowired
    private ISoldierEmploymentInfoService soldierEmploymentInfoService;

    /**
     * 查询退役军人_就业创业列表
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:list')")
    @GetMapping("/list")
    public TableDataInfo list(SoldierEmploymentInfo soldierEmploymentInfo)
    {
        startPage();
        List<SoldierEmploymentInfo> list = soldierEmploymentInfoService.selectSoldierEmploymentInfoList(soldierEmploymentInfo);
        return getDataTable(list);
    }

    /**
     * 导出退役军人_就业创业列表
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:export')")
    @Log(title = "退役军人_就业创业", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(SoldierEmploymentInfo soldierEmploymentInfo)
    {
        List<SoldierEmploymentInfo> list = soldierEmploymentInfoService.selectSoldierEmploymentInfoList(soldierEmploymentInfo);
        ExcelUtil<SoldierEmploymentInfo> util = new ExcelUtil<SoldierEmploymentInfo>(SoldierEmploymentInfo.class);
        return util.exportExcel(list, "退役军人_就业创业数据");
    }

    /**
     * 获取退役军人_就业创业详细信息
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(soldierEmploymentInfoService.selectSoldierEmploymentInfoById(id));
    }

    /**
     * 新增退役军人_就业创业
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:add')")
    @Log(title = "退役军人_就业创业", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SoldierEmploymentInfo soldierEmploymentInfo)
    {
        return toAjax(soldierEmploymentInfoService.insertSoldierEmploymentInfo(soldierEmploymentInfo));
    }

    /**
     * 修改退役军人_就业创业
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:edit')")
    @Log(title = "退役军人_就业创业", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SoldierEmploymentInfo soldierEmploymentInfo)
    {
        return toAjax(soldierEmploymentInfoService.updateSoldierEmploymentInfo(soldierEmploymentInfo));
    }

    /**
     * 删除退役军人_就业创业
     */
    @PreAuthorize("@ss.hasPermi('manager:retirefm_3:remove')")
    @Log(title = "退役军人_就业创业", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(soldierEmploymentInfoService.deleteSoldierEmploymentInfoByIds(ids));
    }
}
